package business.impl;

import java.util.List;

import model.TPractice;
import model.Tstatus;
import model.VGraduate;
import model.VStuinfo;
import business.basic.iHibBaseDAO;
import business.basic.iHibBaseDAOImpl;
import business.dao.StatusDao;

public class StatusDaoImpl implements StatusDao {
	
	iHibBaseDAO bdao = null;
	public void setBdao (iHibBaseDAO bdao){
		this.bdao=bdao;
		
	}

	@Override
	public Tstatus getstatusById(int id) {
		Tstatus title = (Tstatus) bdao.findById(Tstatus.class,id);
		return title;
	}

	@Override
	public int addstatus(Tstatus model) {
		Object obj = bdao.insert(model);
		if (obj == null) {
			return 0;
		}
		return 1;
	}

	@Override
	public boolean upAtom(Tstatus model) {
		return bdao.update(model);
	}

	@Override
	public boolean delstatus(int id) {
		return bdao.delete(Tstatus.class, id);
	}

	@Override
	public List<Tstatus> getstatus() {
		String sql = " from Tstatus ";
		List<Tstatus> modl = bdao.select(sql);
		return modl;
	}

	@Override
	public List<Tstatus> getstatusbystu(int stuid) {
		String sql = " from Tstatus where stuinfoid =   ?";
		Object[] para = {stuid};
		List<Tstatus> modl = bdao.select(sql, para);
		return modl;
	}

	@Override
	public List<VGraduate> getVstatusby() {
		String sql = "  from VGraduate ";
		sql+= "  where isDel = 0 ";
		
		
		

		List<VGraduate> modl = bdao.select(sql);
		return modl;	
	}

}
